<?php if (!defined('THINK_PATH')) exit();?><div id="friendchoose" class="friend clearfix">
<ul id='groups' class="groups">
<?php if(is_array($groups)): ?><?php $i = 0;?><?php $__LIST__ = $groups?><?php if( count($__LIST__)==0 ) : echo "" ; ?><?php else: ?><?php foreach($__LIST__ as $key=>$g): ?><?php ++$i;?><?php $mod = ($i % 2 )?><li id="g_<?php echo ($g["gid"]); ?>" onclick="showgroup('group<?php echo ($g["gid"]); ?>',this,<?php echo ($g["gid"]); ?>);" style="cursor:pointer" <?php if($key==0){ ?>class="current"<?php } ?>><i class="ico-at-group mr5"></i><?php echo ($Key); ?><?php echo ($g["title"]); ?></li><?php endforeach; ?><?php endif; ?><?php else: echo "" ;?><?php endif; ?>
</ul>
<div id="groupusers" class="groupusers">
<?php foreach( $groupusers as $k=>$gu){ ?>
<ul id="<?php echo ($k); ?>">
	<?php foreach($gu as $u){ ?>
		<li onclick="core.at.insertUser('<?php echo ($u["uname"]); ?>')"><a href="javascript:void(0);"><img alt="<?php echo ($u["uname"]); ?>" src="<?php echo ($u["avatar_small"]); ?>"><?php echo ($u["uname"]); ?></a></li>
	<?php } ?>
</ul>
<?php } ?>
</div>
</div>
<!-- <a class="btn-green-small" style="float:right:marign:0;border:0">确定</a> -->
<script>
function showgroup(gname,obj,gid){
	if ( $('#'+gname+' > li').html() == null ){
		$('#groupusers').append('<img src="'+ THEME_URL+'/image/load.gif" id="loadimg" class="alM">');
		$.post(U('public/Feed/changGroup'),{gid:gid},function (res){
			$('#loadimg').remove();
			if ( res ){
				$('#groupusers').append(res);
			}
		});
	}
	
	$('#'+gname).show();
	$('#g_'+gname).addClass('current');
	$('#groups li').removeClass('current');
	$(obj).addClass('current');
	$('#groupusers ul[id!="'+gname+'"]').hide();
}
</script>